﻿Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Data
Imports System.Collections
Imports System.Windows.Forms
Imports DataObject
Imports DataObject.hDBase

Public Class BusNhanVien

    Private NhanVienDAO As New SqlServerNhanVien
    Private oTable As New DataTable

    Public Function GetAllNhanVien(ByVal sStringConnection As String) As Object
        Try
            oTable = NhanVienDAO.GetAllNhanVien(sStringConnection)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
        Return oTable
    End Function

    Public Sub InsertNhanVien(ByVal sStringConnection As String, ByVal oNhanVien As NhanVien)
        Try
            NhanVienDAO.InsertNhanVien(sStringConnection, oNhanVien)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Public Sub UpdateNhanVien(ByVal sStringConnection As String, ByVal oNhanVien As NhanVien)
        Dim bool_ As Boolean = True
        Try
            NhanVienDAO.UpdateNhanVien(sStringConnection, oNhanVien)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Public Sub DeleteNhanVien(ByVal sStringConnection As String, ByVal oNhanVien As NhanVien)
        Try
            NhanVienDAO.DeleteNhanVien(sStringConnection, oNhanVien.SoNV)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

End Class
